package com.hsgene.statistics.controller;

import com.hsgene.common.util.resolver.FromSession;
import com.hsgene.common.util.result.ApiResult;
import com.hsgene.common.util.web.session.UserInfo;
import com.hsgene.statistics.dto.HomeStatisticsDto;
import com.hsgene.statistics.service.StatisticsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 首页统计Controller
 *
 * @author wangbing
 * @version 1.0
 * @date 2018/12/20 11:49
 * Copyright: Copyright (c) 2018
 */
@RestController
@RequestMapping("/v1.0/genetic/testing/home")
public class HomeStatisticsController {

    @Resource
    private StatisticsService statisticsService;

    /**
     * 首页数据统计
     *
     * @return 首页数据统计
     */
    @GetMapping("")
    public ApiResult<HomeStatisticsDto> getHomeStatistics(
            @FromSession UserInfo userInfo) {
        return statisticsService.getHomeStatistics(userInfo.getUserId());
    }
}
